package com.apes.framework.plugin.mq.store;

import com.apes.framework.plugin.mq.domain.MQueue;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;

public interface QueueRepository extends MongoRepository<MQueue, String> {

    Page<MQueue> findByTopicLikeOrderByEndedDesc(String topic, Pageable pageable);
    Page<MQueue> findByTopicLikeAndStateOrderByEndedDesc(String topic, int state, Pageable pageable);
    List<MQueue> findByEndedLessThanEqualOrderByCreatedAsc(String maxTimestamp, Pageable pageable);
    List<MQueue> findByStateAndCreatedGreaterThanAndEndedLessThanEqualOrderByCreatedAsc(int state, String created, String maxTimestamp, Pageable pageable);
}
